package bishiqiangxun;

import javax.xml.namespace.QName;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;

public class Test {
    private static int function(int n, int m) {
        if (n == 1)
            return 0;
        //递归
        int x = function(n - 1, m);
        //返回最后删除的那个元素
        return (m + x) % n;
    }
    public int LastRemaining_Solution(int n, int m) {
        //没有小朋友的情况
        if(n == 0 || m == 0)
            return -1;
        return function(n, m);
    }
    public static void main(String[] args) {
        Queue<int[]> queue = new LinkedList<>();

        int n = 10;
        int m = 17;
     int index = function(10,17);
        System.out.println(index);

    }
}
